package tax_return;

public class Tax1913 {

	private double income;
	private static final double RATE1 = 0.01;
	private static final double RATE2 = 0.02;
	private static final double RATE3 = 0.03;
	private static final double RATE4 = 0.04;
	private static final double RATE5 = 0.05;
	private static final double RATE6 = 0.06;
	private static final double LIMIT1 = 50000;
	private static final double LIMIT2 = 75000;
	private static final double LIMIT3 = 100000;
	private static final double LIMIT4 = 250000;
	private static final double LIMIT5 = 500000;
	
	public Tax1913(double income){
		this.income = income;
	}
	
	public double getTax(){ 
		if(income<LIMIT1){
			return RATE1 * income;
		}
		else if(income<LIMIT2){
			return LIMIT1 * RATE1 + (income - LIMIT1) * RATE2;
		}
		else if(income<LIMIT3){
			return LIMIT1 * RATE1 + (LIMIT2 - LIMIT1) * RATE2 + (income - LIMIT2) * RATE3; 
		}
		else if(income<LIMIT4){
			return LIMIT1 * RATE1 + (LIMIT2 - LIMIT1) * RATE2 + (LIMIT3 - LIMIT2) * RATE3
					+ (income - LIMIT3) * RATE4;
		}
		else if(income<LIMIT5){
			return LIMIT1 * RATE1 + (LIMIT2 - LIMIT1) * RATE2 + (LIMIT3 - LIMIT2) * RATE3
					+ (LIMIT4 - LIMIT3) * RATE4 + (income - LIMIT4) * RATE5;
		}
		else{
			return LIMIT1 * RATE1 + (LIMIT2 - LIMIT1) * RATE2 + (LIMIT3 - LIMIT2) * RATE3
					+ (LIMIT4 - LIMIT3) * RATE4 + (LIMIT5 - LIMIT4) * RATE5 +
					(income - LIMIT5) * RATE6;
		}
		
	}
	
}
